﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Summary description for DBAccess
/// </summary>
public class DBAccess
{
    string strConn;
    protected SqlConnection conn;
	public DBAccess()
	{
        strConn = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
        conn = new SqlConnection(strConn);
	}

    public bool Connect()
    {
        try
        {
            if (conn.State != ConnectionState.Closed)
            {
                conn.Close();
                conn.Open();

            }
            else conn.Open();
            return true;
        }
        catch (Exception ex) { }
        return false;

    }


    public void Disconnect()
    {
        try
        {
            conn.Close();
        }
        catch (Exception ex) { throw ex; }

    }
}